package com.luguotao.lease.common.context;


// *  把封装了登录用户信息的 loginUser对象 保存到ThrealdLocal 线程中
public class LoginUserContext {
    //建一个变量
    private static ThreadLocal<LoginUser> threadLocal = new ThreadLocal<>();

    //保存数据到里面
    public static void setUser(LoginUser loginUser){
        threadLocal.set(loginUser);
    }
    //获取数据
    public static LoginUser getUser(){
        return threadLocal.get();
    }

    //删除数据
    public static void removeUser(){
        threadLocal.remove();
    }
}
